HAL ADC type migration ¶
This section provides information about the HAL ADC type migration.
HAL ADC enumeration migration ¶
HAL ADC callback ID type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_ADC_CONVERSION_COMPLETE_CB_ID,
HAL_ADC_CONVERSION_HALF_CB_ID,
HAL_ADC_LEVEL_OUT_OF_WINDOW_1_CB_ID,
HAL_ADC_ERROR_CB_ID,
HAL_ADC_INJ_CONVERSION_COMPLETE_CB_ID,
HAL_ADC_INJ_QUEUE_OVERFLOW_CB_ID,
HAL_ADC_LEVEL_OUT_OF_WINDOW_2_CB_ID,
HAL_ADC_LEVEL_OUT_OF_WINDOW_3_CB_ID,
HAL_ADC_END_OF_SAMPLING_CB_ID,
HAL_ADC_END_OF_CALIBRATION_CB_ID,
HAL_ADC_VOLTAGE_REGULATOR_CB_ID,
HAL_ADC_ADC_READY_CB_ID,
HAL_ADC_MSPINIT_CB_ID,
HAL_ADC_MSPDEINIT_CB_ID
} HAL_ADC_CallbackIDTypeDef;
|
Removed. Note The callback registration in HAL2 is handled by specific functions for each ADC event. |
The update from HAL1 to HAL2 involves a significant change in the way callback functions are registered for ADC events.
Related concept: Individual callback registration APIs replace global register and unregister functions
HAL ADC structure migration ¶
HAL ADC handle type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
ADC_HandleTypeDef |
hal_adc_handle_t |
Related concept: Replaced TypeDef suffix with _t in type names
HAL ADC oversampling type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t Ratio;
uint32_t RightBitShift;
uint32_t TriggeredMode;
uint32_t OversamplingStopReset;
} ADC_OversamplingTypeDef;
|
typedef struct
{
uint16_t ratio;
uint8_t shift;
hal_adc_ovs_discont_t discont;
hal_adc_ovs_scope_t scope;
} hal_adc_ovs_config_t;
|
Related concept: Replaced TypeDef suffix with _t in type names
HAL ADC injection configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
ADC_InjectionConfTypeDef |
Structure split into:
|
typedef struct
{
uint32_t ExternalTrigInjecConv;
uint32_t ExternalTrigInjecConvEdge;
uint32_t InjectedNbrOfConversion;
FunctionalState InjectedDiscontinuousConvMode;
uint32_t InjectedRank;
uint32_t InjectedSamplingTime;
uint32_t InjectedSingleDiff;
uint32_t InjectedChannel;
uint32_t InjectedOffset;
uint32_t InjectedOffsetSign;
FunctionalState InjectedOffsetSaturation;
FunctionalState InjectedOffsetSignedSaturation;
uint32_t InjectedOffsetNumber;
uint32_t InjectedLeftBitShift;
FunctionalState AutoInjectedConv;
FunctionalState InjecOversamplingMode;
ADC_InjOversamplingTypeDef InjecOversampling;
} ADC_InjectionConfTypeDef;
|
typedef struct
{
hal_adc_inj_trig_src_t trigger_src;
hal_adc_inj_trig_edge_t trigger_edge;
uint8_t sequencer_length;
hal_adc_inj_seq_discont_length_t sequencer_discont;
} hal_adc_inj_config_t;
typedef struct
{
hal_adc_group_t group;
uint8_t sequencer_rank;
hal_adc_sampling_time_t sampling_time;
hal_adc_in_mode_t input_mode;
} hal_adc_channel_config_t;
typedef struct
{
hal_adc_channel_t channel;
int32_t level;
hal_adc_offset_sat_sign_state_t saturation_signed;
hal_adc_offset_sat_unsign_state_t saturation_unsigned;
} hal_adc_offset_config_t;
typedef struct
{
hal_adc_ovs_scope_t scope;
hal_adc_ovs_discont_t discont;
uint16_t ratio;
uint8_t shift;
} hal_adc_ovs_config_t;
|
Related concept: Replaced TypeDef suffix with _t in type names
HAL ADC multimode type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
ADC_MultiModeTypeDe |
hal_adc_mm_config_t |
typedef struct
{
uint32_t Mode;
uint32_t DualModeData;
uint32_t TwoSamplingDelay;
} ADC_MultiModeTypeDef;
|
typedef struct
{
hal_adc_mm_mode_t mode;
hal_adc_mm_reg_data_format_t reg_data_format;
hal_adc_mm_interl_delay_t interl_delay;
#if defined(USE_HAL_ADC_DMA) && (USE_HAL_ADC_DMA == 1)
hal_adc_mm_reg_data_transfer_pack_t reg_data_transfer_packing;
#endif /* USE_HAL_ADC_DMA */
} hal_adc_mm_config_t;
|
Related concept: Replaced TypeDef suffix with _t in type names
HAL ADC injected oversampling type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
ADC_InjOversamplingTypeDef |
hal_adc_ovs_config_t |
typedef struct
{
uint32_t Ratio;
uint32_t RightBitShift;
} ADC_InjOversamplingTypeDef;
|
typedef struct
{
uint16_t ratio;
uint8_t shift;
hal_adc_ovs_scope_t scope;
hal_adc_ovs_discont_t discont;
} hal_adc_ovs_config_t;
|
Related concept: Replaced TypeDef suffix with _t in type names
HAL ADC initialization type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
ADC_InitTypeDef |
Structure split into:
|
typedef struct
{
uint32_t ClockPrescaler;
uint32_t Resolution;
uint32_t TriggerFrequencyMode;
uint32_t SamplingTimeCommon1;
uint32_t SamplingTimeCommon2;
uint32_t DataAlign;
uint32_t LeftBitShift;
uint32_t GainCompensation;
FunctionalState LowPowerAutoWait;
uint32_t LowPowerAutoPowerOff;
uint32_t ExternalTrigConv;
uint32_t ExternalTrigConvEdge;
uint32_t NbrOfConversion;
FunctionalState DiscontinuousConvMode;
FunctionalState ContinuousConvMode;
uint32_t Overrun;
FunctionalState DMAContinuousRequests;
uint32_t ConversionDataManagement;
uint32_t ScanConvMode;
FunctionalState OversamplingMode;
ADC_OversamplingTypeDef Oversampling;
uint32_t EOCSelection;
uint32_t NbrOfDiscConversion;
uint32_t VrefProtection;
} ADC_InitTypeDef;
|
typedef struct
{
hal_adc_clock_t clock;
hal_adc_resolution_t resolution;
hal_adc_trigger_freq_mode_t trigger_freq_mode;
hal_adc_sampling_time_com_t sampling_time_com1;
hal_adc_sampling_time_com_t sampling_time_com2;
hal_adc_sampling_mode_t sampling_mode;
} hal_adc_config_t;
typedef struct
{
hal_adc_left_bit_shift_t left_bit_shift;
uint32_t gain_compensation_x1000;
} hal_adc_post_processing_config_t;
typedef struct
{
hal_adc_lp_auto_wait_state_t lp_auto_wait;
hal_adc_lp_auto_power_off_state_t lp_auto_power_off;
hal_adc_lp_autonomous_dpd_state_t lp_autonomous_dpd;
} hal_adc_low_power_config_t;
typedef struct
{
hal_adc_reg_trig_src_t trigger_src;
hal_adc_reg_trig_edge_t trigger_edge;
uint8_t sequencer_length;
hal_adc_reg_seq_discont_length_t sequencer_discont;
hal_adc_reg_continuous_mode_t continuous;
hal_adc_reg_overrun_mode_t overrun;
hal_adc_reg_data_transfer_mode_t data_transfer;
} hal_adc_reg_config_t;
typedef struct
{
hal_adc_ovs_scope_t scope;
hal_adc_ovs_discont_t discont;
uint16_t ratio;
uint8_t shift;
} hal_adc_ovs_config_t;
|
Related concept: Replaced TypeDef suffix with _t in type names
HAL ADC channel configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
ADC_ChannelConfTypeDef |
Structure split into 1. hal_adc_channel_config_t 2. hal_adc_offset_config_t |
typedef struct
{
uint32_t Channel;
uint32_t Offset;
uint32_t OffsetSign;
FunctionalState OffsetSaturation;
uint32_t Rank;
uint32_t SamplingTime;
uint32_t SingleDiff;
uint32_t OffsetNumber;
} ADC_ChannelConfTypeDef;
|
typedef struct
{
hal_adc_channel_t channel;
int32_t level;
hal_adc_offset_sat_sign_state_t saturation_signed;
hal_adc_offset_sat_unsign_state_t saturation_unsigned;
} hal_adc_offset_config_t;
typedef struct
{
uint8_t sequencer_rank;
hal_adc_sampling_time_t sampling_time;
hal_adc_in_mode_t single_diff;
hal_adc_group_t group;
} hal_adc_channel_config_t;
|
Related concept: Replaced TypeDef suffix with _t in type names
HAL ADC analog watchdog configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t HighThreshold;
uint32_t LowThreshold;
uint32_t FilteringConfig;
uint32_t WatchdogMode;
uint32_t Channel;
uint32_t WatchdogNumber;
FunctionalState ITMode;
} ADC_AnalogWDGConfTypeDef;
|
typedef struct
{
int32_t threshold_high;
int32_t threshold_low;
hal_adc_awd_filtering_t filtering;
hal_adc_group_t group;
hal_adc_channel_t channel;
} hal_adc_awd_config_t;
|
Related concept: Replaced TypeDef suffix with _t in type names
HAL ADC callback type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
pADC_CallbackTypeDef |
hal_adc_cb_t |
Related concept: Replaced TypeDef suffix with _t in type names